<?php

use yii\helpers\Html;
use yii\widgets\DetailView;

/* @var $this yii\web\View */
/* @var $model app\models\Park */

$this->title = $model->name;
$this->params['breadcrumbs'][] = ['label' =>$model->company->name, 'url' => ['company/view','id'=>$model->company->id]];
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="park-view">

    <h1><?= Html::encode($this->title) ?></h1>

    <p>
        <?= Html::a('更新', ['update', 'id' => $model->id], ['class' => 'btn btn-primary']) ?>
        <?= Html::a('删除', ['delete', 'id' => $model->id], [
            'class' => 'btn btn-danger',
            'data' => [
                'confirm' => 'Are you sure you want to delete this item?',
                'method' => 'post',
            ],
        ]) ?>
        <!--?= Html::a('查看作物', ['/backend/crop/parkview', 'id' => $model->id], ['class' => 'btn btn-primary']) ?-->
    </p>

    <?= DetailView::widget([
        'model' => $model,
        'attributes' => [
            [
                'label'=>'所属公司',
                'value'=>$model->company->name,
                'type'=>'html',
            ],
            'code',
            'name',
            'addr',
            'scale',
            'build_date:date',
            'start_date:date',
            'introduction:ntext',
            'tel',
            'email:email',
            'comment',
            //'map_image',
            // 'qualification_image',
            [
                'label'=>'负责人',
                'value'=>$model->pricipal->name,
            ],
            [
                'label'=>'联系人',
                'value'=>$model->contact->name,
            ],

        ],
    ]) ?>

    <p>
        <?= Html::a('新增地块', ['/backend/land/create'], ['class' => 'btn btn-success']) ?>
    </p>

    <?= \yii\grid\GridView::widget([
        'dataProvider' => $dataProvider,
   //    'filterModel' => $searchModel,
        'columns' => [
            ['class' => 'yii\grid\SerialColumn'],
            'code',
            'name',
            'scale',
            'tel',
            'email:email',
            ['class' => 'yii\grid\ActionColumn','controller' => 'land'],
        ],
    ]); ?>



</div>
